//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    class ExternalRow: IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        public void ReadXml(ReadContext context)
        {
            using (ReadContext c = context.Read("row"))
            {
                r = c.GetInteger("r");
                while (c.ReaderLocalName == "cell")
                    Cells.Add(c.ReadElement<ExternalCell>());

            }
        }

        public void WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("row"))
            {
                c.SetInteger("r", r);
                foreach (ExternalCell cell in Cells)
                    c.WriteElement(cell);
            }
        }

        #endregion
        private int r;

        public int RowIndex
        {
            get { return r; }
        }

        private readonly List<ExternalCell> _cells = new List<ExternalCell>();

        public List<ExternalCell> Cells
        {
            get { return _cells; }
        }
	
	
    }
}
